# build in python 3.5.2
# 作者：陈常鸿
# 信息熵
# 抛硬币的例子
import numpy as np
import matplotlib.pyplot as plt
x=np.linspace(0,1,101)
y=-x*np.log2(x)-(1-x)*np.log2(1-x)
y[np.isnan(y)]=0
plt.plot(x,y)
plt.show()